home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -websites- / wirenet / files / thor25_arexx.lha / Examples / Progress_ex.thor < prev    next >
Text File  |  1995-09-06  |  1KB  |  69 lines

  1. /*
  2. **
  3. ** Progress_Ex.thor  - Example script for the progressbar functions in THOR 2.0
  4. **
  5. */
  6.  
  7.     options results
  8.  
  9.     if(substr(address(),1,4) ~= "THOR") then do
  10.         parse arg thorport
  11.         if~(show(p, thorport)) then do
  12.             if ~(show(p, "THOR.01")) then do
  13.                 say "No THOR port found!"
  14.                 exit
  15.             end
  16.             else thorport = "THOR.01"
  17.         end
  18.     end
  19.     else thorport = address()
  20.  
  21.     if ~show('p', 'BBSREAD') then do
  22.         address command
  23.             "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  24.             "WaitForPort BBSREAD"
  25.     end
  26.  
  27.     signal on ERROR
  28.  
  29.     address(BBSREAD)
  30.  
  31.     GETBBSLIST stem BBSLIST
  32.     if(rc ~= 0) then 
  33.     do
  34.         address(thorport)
  35.         REQUESTNOTIFY TEXT '"'BBSREAD.LASTERROR'"' BT '"_Ok"'
  36.         exit
  37.     end
  38.  
  39.     address(thorport)
  40.  
  41.     THORTOFRONT
  42.  
  43.     OPENPROGRESS TITLE '"Progress Test"' AT '"_Abort"' PCW 30
  44.     if(rc = 0) then
  45.     do
  46.         window = result        /* Important !!! */
  47.  
  48.         do i=1 to BBSLIST.COUNT
  49.             /* Display bbsname and reset progressbar.*/
  50.             UPDATEPROGRESS REQ window TOTAL 50 PT '"'BBSLIST.i'"'
  51.             do n=1 to 50
  52.                 /* Update progressbar 50 times for each bbs */
  53.                 UPDATEPROGRESS REQ window CURRENT n    
  54.                 if(rc ~= 0) then do
  55.                     /* Check if user aborted */
  56.                     CLOSEPROGRESS REQ window
  57.                     window = 0
  58.                     leave
  59.                 end
  60.             end
  61.         end
  62.     end
  63.  
  64. ERROR:
  65.  
  66.     if(window ~= 0) then CLOSEPROGRESS REQ window
  67.  
  68. exit
  69.